﻿using System;

public class ShapeFactory
{
    public static IShape CreateShape(string shapeType)
    {
        Random rand = new Random();
        switch (shapeType.ToLower())
        {
            case "rectangle":
                return new Rectangle(rand.Next(1, 10), rand.Next(1, 10));
            case "square":
                return new Square(rand.Next(1, 10));
            case "triangle":
                // Ensure triangle inequality holds
                int sideA = rand.Next(1, 10);
                int sideB = rand.Next(1, 10);
                int sideC = rand.Next(Math.Abs(sideA - sideB) + 1, sideA + sideB); // Ensures valid triangle
                return new Triangle(sideA, sideB, sideC);
            default:
                throw new ArgumentException("Invalid shape type");
        }
    }
}